<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        发票列表添加
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/index.css">

</head>
<body>

<div class="layui-card">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">

        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>邮寄地址
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="address" id="address" style="width: 100%;height: 36px">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>物流企业id
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="companyid" id="companyId" style="width: 100%;height: 36px">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>司机id
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="driverId" id="driverId" style="width: 100%;height: 36px">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>不含税金额
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="excludingTaxMoney" id="excludingTaxMoney"
                                   style="width: 100%;height: 36px">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>发票申请号
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="invoiceNum" id="invoiceNum" autocomplete="off" placeholder="1~16以内"
                                   class="layui-input" lay-verify="required">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>状态
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="state" id="state" class="layui-input" lay-verify="number"
                                   autocomplete="off" placeholder="0待开票，1已开票，2已驳回">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>税率
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="taxRate" id="taxRate" style="width: 100%;height: 36px">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>纳税人
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="taxpayer" id="taxpayer" autocomplete="off" placeholder="请输入姓名"
                                   class="layui-input" lay-verify="number">
                        </div>
                    </div>
                    <!-- <div class="layui-form-item">
                         <label class="layui-form-label">状态</label>
                         <div class="layui-input-block">
                             <input type="radio" name="status" value="1" title="启用" >
                             <div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                 <div>启用</div>
                             </div>
                             <input type="radio" name="status" value="0" title="禁用" >
                             <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                 <div>禁用</div>
                             </div>
                         </div>
                     </div>
                     <div class="layui-form-item">
                         <label class="layui-form-label">
                             <span class='x-red'>*</span>运费金额
                         </label>
                         <div class="layui-input-block">
                             <input type="text" name="sort1" autocomplete="off" placeholder="请输入金额"
                                    class="layui-input" lay-verify="number">
                         </div>
                     </div>
                     <div class="layui-form-item">
                         <label class="layui-form-label">
                             <span class='x-red'>*</span>税额
                         </label>
                         <div class="layui-input-block">
                             <input type="text" name="sort1" autocomplete="off" placeholder="请输入税额"
                                    class="layui-input" lay-verify="number">
                         </div>
                     </div>
                     <div class="layui-form-item layui-form-text">
                         <label class="layui-form-label">
                             <span class='x-red'>*</span>描述
                         </label>
                         <div class="layui-input-block">
                             <textarea placeholder="请输入内容" class="layui-textarea" name="info"></textarea>
                         </div>
                     </div>-->
                    <div class="layui-form-item" style="text-align:center;">
                        <input class="layui-btn" value="保存" type="button" id="bu1">
                        <!-- <button class="layui-btn" lay-submit="" lay-filter="*" id="bu1">
                             保存
                         </button>-->
                    </div>
                </form>
                <div style="height:100px;"></div>
            </div>

        </div>
    </div>
</div>
<script src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/index.js"></script>
<!-- <script>
     layui.use(['element','layer','form'], function(){
         $ = layui.jquery;//jquery
         lement = layui.element();//面包导航
         layer = layui.layer;//弹出层
         form = layui.form()
         okLoading.close($);


         //监听提交
         form.on('submit(*)', function(data){
             var name = $("input[name=name]").val();
             if(name ==""){
                 layer.msg("名称不能为空！",{icon:5,time:2000});return false;
             }
             var data = data.field;
             $.ajax({
                 type:"post",
                 url:"",
                 data:data,
                 dataType:"json",
                 success:function (data) {
                     if(data.status==1){
                         layer.msg(data.info,{icon:1,time:1000});
                         setTimeout(function(){
                             window.parent.location.reload();
                             var index = parent.layer.getFrameIndex(window.name);
                             parent.layer.close(index);
                         },1000);
                         return false;
                     }else{
                         layer.msg(data.info,{icon:5,time:2000});return false;
                     }
                 }
             });
             return false;
         });

     })
 </script>-->
<script>
    document.getElementById("bu1").onclick = function () {
        var list = {
            "address": document.getElementById("address").value,

            "companyId": document.getElementById("companyId").value,

            "driverId": document.getElementById("driverId").value,
            "excludingTaxMoney": document.getElementById("excludingTaxMoney").value,

            "invoiceNum": document.getElementById("invoiceNum").value,

            "state": document.getElementById("state").value,
            "taxRate": document.getElementById("taxRate").value,
            "taxpayer": document.getElementById("taxpayer").value
        };
        var lists = JSON.stringify(list);
        $.ajax({
            type: 'Post',
            // 如果使用这种url写法，则不需要再写在data中
            // url: '/test/getGoodsInfoByStatus?status=' + 1,

            url: 'http://localhost:5500/t-invoice/addInvoice',
            data: lists,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                console.log(result);
                alert("添加成功");

            }, error: function (e) {//响应不成功时返回的函数
                console.log(e, 'error');
                alert("错误");
            }
        });

    };
</script>


</body>
</html>